import * as types from './mutation-types'
import { sortBy } from 'underscore'
const mutations = {
    [types.SET_U](state, n) {
        state.user = n
    },
    [types.SET_SCHOOL](state, n) {
        state.school = n
    },
    [types.SET_SCHOOLADDRESS](state, n) {
        state.schooladdress = n
    },
    [types.SET_SCHOOLUSER](state, n) {
        state.schooluser = n
    },
    [types.SET_SCHOOLCLASSROOM](state, n) {
        state.schoolclassroom = n
    },
    [types.SET_SCHOOLROLE](state, n) {
        state.schoolrole = n
    },
    [types.SET_SCHOOLAUTHTYPE](state, n) {
        state.schoolauthtype = n
    },
    [types.SET_SCHOOLCOURSE](state, n) {
        state.schoolcourse = n
    },
    [types.SET_SCHOOLCLASSHOUR](state, n) {
        state.schoolclasshour = n
    },
    [types.SET_SCHOOLCLAZZ](state, n) {
        state.schoolclazz = n
    },
    [types.SET_SCHOOLHOLIDAY](state, n) {
        state.schoolholiday = n
    },
    [types.SET_SCHOOLCLASSTIME](state, n) {
        state.schoolclasstime = sortBy(n, v => Number(v.starttime.split(":")[0]))
    },
    [types.SET_PACKEGEKEY](state, n) {
        state.packegekey = n
    },
    [types.SET_SCHOOLSTUDENT](state, n) {
        state.schoolstudent = n
    },
    [types.SET_SCHOOLHOMEWORK](state, n) {
        state.schoolhomework = n
    },
    [types.SET_SCHOOANNOUNCEMENTPUSH](state, n) {
        state.schoolannouncementpush = n
    },
    [types.SET_SCHOOLITEMBANKGROUP](state, n) {
        state.schoolitembankgroup = n
    },
    setstate(state, n) {
        state.state = n
    }
}
export default mutations